﻿<%@ Page Language="C#" MasterPageFile="~/RightFrame.Master" AutoEventWireup="true" CodeBehind="DistributeRole.aspx.cs" Inherits="MyOA.UI.SysManage.RoleManage.DistributeRole" Title="无标题页" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphTitle" runat="server">
你的位置：<a href="RoleManage.aspx?NodeValuePath=105001">角色管理</a>>分配角色权限
<script type="text/javascript">
    var Alert=ymPrompt.alert;
    var Error=ymPrompt.errorInfo;
    function checkBoxClick(id)
    {
        //获取子菜单外的DIV
        var str=id.substring(0,id.lastIndexOf("_"));
        str+="_divChildrenSysFun";
        
        //获取子菜单DIV的INPUT集合
        var inputs=document.getElementById(str).getElementsByTagName("input");
        for(var i=0;i<inputs.length;i++)
        {
            if(inputs[i].type=="checkbox")
            {
               inputs[i].checked= document.getElementById(id).checked;
            }
        }
    }
    
    function childCheckBoxClick(id)
    {
        //获取父CHECKBOX
        var str=id.substring(0,id.indexOf("rpChildren"));
        str+="cbParent";
        var parentCheckbox=document.getElementById(str);
        
        //如果子CHECKBOX选中的话 他的父CHECKBOX也选中
        if(document.getElementById(id).checked)
        {
            parentCheckbox.checked=true;
        }
    }
    
    function aHref()
    {
        document.location.href="RoleManage.aspx?NodeValuePath=105001";
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContnent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <div class="body_title">分&nbsp;&nbsp;配&nbsp;&nbsp;角&nbsp;&nbsp;色&nbsp;&nbsp;权&nbsp;&nbsp;限</div>
    <div class="body_content">
        <div>权限分配
             <span style="color:Red; margin-right:20px">(选定后保存)</span>
             <span style="font-weight:bolder">当前角色：<asp:Label ID="lblRoleName" runat="server" Text=""></asp:Label></span>
        </div> 
        
        <div class="body">
             
            <asp:Repeater ID="rpParent" runat="server" 
                onitemdatabound="rpParent_ItemDataBound">
                <ItemTemplate>
                 
                    <div>
                        <asp:CheckBox ID="cbParent" runat="server" onclick="checkBoxClick(this.id)"  Text='<%#Eval("displayname") %>' CssClass="cbParent" />
                    
                    </div>
                    <!--绑定NODEID 隐藏控件-->
                    <asp:HiddenField ID="hfdNodeId" runat="server" Value='<%#Eval("nodeid") %>' />
                  <div id="divChildrenSysFun" runat="server">
                    <asp:Repeater ID="rpChildren" runat="server"  OnItemDataBound="rpChildren_ItemDataBound">
                        <ItemTemplate>
                            <span>
                                 <asp:CheckBox ID="cbChildren" runat="server"  onclick="childCheckBoxClick(this.id)" Text='<%#Eval("displayname") %>'/>
                                 
                            </span>
                             <!--绑定NODEID 隐藏控件-->
                    <asp:HiddenField ID="hfdChildrenNodeId" runat="server" Value='<%#Eval("nodeid") %>' />
                        </ItemTemplate>
                    </asp:Repeater>
                   </div>
                    <hr />
                  
                </ItemTemplate>
            </asp:Repeater>
        </div>  
        
        <div style="text-align:center; margin-top:10px;">
            <span>
                <asp:Button ID="btnSave" runat="server" Text="保存" CssClass="btn" 
                    onMouseOver="document.getElementById(this.id).className='btnOver'" 
                    onMouseOut="document.getElementById(this.id).className='btnOut'" 
                onclick="btnSave_Click" />
             </span>
             
             <span>
                 <input id="Button1" type="button" value="退出" class="btn" 
                onMouseOver="document.getElementById(this.id).className='btnOver'" 
                   onMouseOut="document.getElementById(this.id).className='btnOut'" 
                   onclick="javascript:document.location.href='RoleManage.aspx?NodeValuePath=105001'" />
                </span>
        </div>
    </div>
   </ContentTemplate></asp:UpdatePanel>
</asp:Content>
